<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="职工号" prop="emp_numbedr">
        <el-input
          v-model="queryParams.emp_numbedr"
          placeholder="请输入职工号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政治面貌" prop="zzmm">
        <el-select v-model="queryParams.zzmm" placeholder="请选择政治面貌" clearable size="small">
         <!-- <el-option
            v-for="dict in dict.type.zzmm_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />-->
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['business:kyinfoTb:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['business:kyinfoTb:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['business:kyinfoTb:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['business:kyinfoTb:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
        >导入</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
<!--姓名、年龄、性别、职称、职务、学位、学历、学科方向、学术专长和联系方式-->
    <el-table v-loading="loading" :data="kyinfoTbList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
<!--      <el-table-column label="职工号" align="center" prop="empNumbedr" />-->
      <el-table-column label="姓名" align="center" prop="name" />
      <el-table-column label="年龄" align="center" prop="age" />
      <el-table-column label="性别" align="center" prop="gender" />
      <el-table-column label="政治面貌" align="center" prop="zzmm" />
      <el-table-column label="民族" align="center" prop="national" />
      <el-table-column label="职务" align="center" prop="position" />
      <el-table-column label="职称" align="center" prop="title" />
      <el-table-column label="学位" align="center" prop="degree" />
      <el-table-column label="学历" align="center" prop="xl" />
      <el-table-column label="学科方向" align="center" prop="xkfx" />
      <el-table-column label="学术专长" align="center" prop="xszz" width="200px" show-overflow-tooltip/>
      <el-table-column label="英文名" align="center" prop="eName" />
      <el-table-column label="邮箱" align="center" prop="email" width="150"/>
      <el-table-column label="联系方式" align="center" prop="phone" width="150"/>
      <el-table-column label="籍贯" align="center" prop="jg" width="200" show-overflow-tooltip/>
      <el-table-column label="出生年月" align="center" prop="birthday" width="120" />
      <el-table-column label="备注" align="center" prop="remark" width="200" show-overflow-tooltip/>
      <el-table-column label="操作" width="155" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['business:kyinfoTb:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['business:kyinfoTb:remove']"
          >删除</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-printer"
            @click="printKyry(scope.row)"
          >打印</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改科研人员信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="姓名" prop="name">
              <el-input v-model="form.name" placeholder="请输入姓名" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="头像" prop="headPort">
              <el-input v-model="form.headPort" placeholder="请输入头像" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="邮箱" prop="email">
              <el-input v-model="form.email" placeholder="请输入邮箱" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="年龄" prop="age">
              <el-input v-model="form.age" placeholder="请输入年龄" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="性别" prop="gender">
              <el-input v-model="form.gender" placeholder="请输入性别" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="民族" prop="national">
              <el-input v-model="form.national" placeholder="请输入民族" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="职务" prop="position">
              <el-input v-model="form.position" placeholder="请输入职务" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="职称" prop="title">
              <el-input v-model="form.title" placeholder="请输入职称" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="学位" prop="degree">
              <el-input v-model="form.degree" placeholder="请输入学位" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="学历" prop="xl">
              <el-input v-model="form.xl" placeholder="请输入学历" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="学科方向" prop="xkfx">
              <el-input v-model="form.xkfx" placeholder="请输入学科方向" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="学术专长" prop="xszz">
              <el-input v-model="form.xszz" placeholder="请输入学术专长" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="英文名" prop="eName">
              <el-input v-model="form.eName" placeholder="请输入英文名" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="承担项目" prop="cdxm">
              <el-input v-model="form.cdxm" placeholder="请输入承担项目" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="科技成果" prop="kjcg">
              <el-input v-model="form.kjcg" placeholder="请输入科技成果" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="专家贡献" prop="zjgx">
              <el-input v-model="form.zjgx" placeholder="请输入专家贡献" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="参与项目" prop="cyxm">
              <el-input v-model="form.cyxm" placeholder="请输入参与项目" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="获奖情况" prop="hjqk">
              <el-input v-model="form.hjqk" placeholder="请输入获奖情况" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="评审项目" prop="psxm">
              <el-input v-model="form.psxm" placeholder="请输入评审项目" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="评审意见" prop="psyj">
              <el-input v-model="form.psyj" placeholder="请输入评审意见" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="政治面貌" prop="zzmm">
              <el-input v-model="form.zzmm" placeholder="请输入政治面貌" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="籍贯" prop="jg">
              <el-input v-model="form.jg" placeholder="请输入籍贯" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="出生年月" prop="birthday">
              <el-input v-model="form.birthday" placeholder="请输入出生年月" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="职工号" prop="empNumbedr">
              <el-input v-model="form.empNumbedr" placeholder="请输入职工号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="身份证号码" prop="idNumber">
              <el-input v-model="form.idNumber" placeholder="请输入身份证号码" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="入职时间" prop="entryTime">
              <el-date-picker clearable
                              v-model="form.entryTime"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="请选择入职时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="公司代码" prop="schoolCode">
              <el-input v-model="form.schoolCode" placeholder="请输入公司代码" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="公司名称" prop="schoolName">
              <el-input v-model="form.schoolName" placeholder="请输入公司名称" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="公司代码" prop="collegeCode">
              <el-input v-model="form.collegeCode" placeholder="请输入公司代码" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="公司名称" prop="collegeName">
              <el-input v-model="form.collegeName" placeholder="请输入公司名称" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="部系代码" prop="deptCode">
              <el-input v-model="form.deptCode" placeholder="请输入部系代码" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="专家级别" prop="expertLevel">
              <el-input v-model="form.expertLevel" placeholder="请输入专家级别" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="部系名称" prop="deptName">
              <el-input v-model="form.deptName" placeholder="请输入部系名称" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="电话" prop="phone">
              <el-input v-model="form.phone" placeholder="请输入电话" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="科研团队类型" prop="kytdlx">
              <el-input v-model="form.kytdlx" placeholder="请输入科研团队类型" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="科研团队代码" prop="kytddm">
              <el-input v-model="form.kytddm" placeholder="请输入科研团队代码" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="人员类别" prop="rylb">
              <el-input v-model="form.rylb" placeholder="请输入人员类别" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="人员状态" prop="userState">
              <el-input v-model="form.userState" placeholder="请输入人员状态" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="科研团队名称" prop="kytdmc">
              <el-input v-model="form.kytdmc" placeholder="请输入科研团队名称" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="创建人" prop="createUser">
              <el-input v-model="form.createUser" placeholder="请输入创建人" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="创建日期" prop="createDate">
              <el-date-picker clearable
                              v-model="form.createDate"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="请选择创建日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="修改人" prop="updateUser">
              <el-input v-model="form.updateUser" placeholder="请输入修改人" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="修改日期" prop="updateDate">
              <el-date-picker clearable
                              v-model="form.updateDate"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="请选择修改日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" placeholder="请输入备注" />
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport+'&type='+upload.type"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <!--  <div class="el-upload__tip" slot="tip">
              <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
            </div>-->
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog title="打印个人信息" :visible.sync="printShow" width="850px"append-to-body>
      <div id="printBill" style="height: 700px;padding-top:10px">
        <el-container>
          <el-container>
<!--            <el-aside width="200px">头像</el-aside>-->
            <el-main>
              <div class="titleG" >个人简历</div>
              <div class="pBox">
                <div class="box_top">
                  <div class="tou">
<!--
                    <el-image style="width: 80%; height: 180px;display:block;margin:0 auto;padding-top:15px" :src="require('../../../assets/images/liu.jpeg')"></el-image>
-->
                  </div>
                  <div class="infoBox">
                    <div class="item1">姓名</div>
                    <div class="item2">{{info.name}}</div>
                    <div class="item1">性别</div>
                    <div class="item2">{{info.gender}}</div>
                    <div class="item1">籍贯</div>
                    <div class="item3">{{info.jg}}</div>
                  </div>
                  <div class="infoBox">
                    <div class="item1">年龄</div>
                    <div class="item2">{{info.age}}</div>
                    <div class="item1">英文名</div>
                    <div class="item2">{{info.eName}}</div>
                    <div class="item1">联系方式</div>
                    <div class="item3">{{info.phone}}</div>
                  </div>
                  <div class="infoBox">
                    <div class="item1">民族</div>
                    <div class="item2">{{info.national}}</div>
                    <div class="item1">政治面貌</div>
                    <div class="item2">{{info.zzmm}}</div>
                    <div class="item1">邮箱</div>
                    <div class="item3">{{info.email}}</div>
                  </div>
                </div>
                <div class="box_bottom">
                  <div class="xiaBox">
                    <div class="xiaName">学位信息</div>
                    <div class="xiaItem1">
                      <div class="xiaItem1_top">学历</div>
                      <div class="xiaItem1_bottom">{{info.xl}}</div>
                    </div>
                    <div class="xiaItem1">
                      <div class="xiaItem1_top">学位</div>
                      <div class="xiaItem1_bottom">{{info.degree}}</div>
                    </div>
                    <div class="xiaItem2">
                      <div class="xiaItem2_top">学科方向</div>
                      <div class="xiaItem2_bottom">{{info.xkfx}}</div>
                    </div>
                  </div>

                  <div class="xiaBox">
                    <div class="xiaName">职位信息</div>
                    <div class="xiaItem1">
                      <div class="xiaItem1_top">职务</div>
                      <div class="xiaItem1_bottom">{{info.position}}</div>
                    </div>
                    <div class="xiaItem1">
                      <div class="xiaItem1_top">职称</div>
                      <div class="xiaItem1_bottom">{{info.title}}</div>
                    </div>
                    <div class="xiaItem2">
                      <div class="xiaItem2_top">出生年月</div>
                      <div class="xiaItem2_bottom">{{info.birthday}}</div>
                    </div>
                  </div>

                  <div class="xiaBox">
                    <div class="xiaName" style="border-bottom: none">学术专长</div>
                    <div class="xiaMain">{{info.xszz}}</div>
                  </div>
                </div>
              </div>
            </el-main>
          </el-container>
        </el-container>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="printInfo">打 印</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listAKyinfoTb, getAKyinfoTb, delAKyinfoTb, addAKyinfoTb, updateAKyinfoTb } from "@/api/pm/aKyinfoTb";
import { getToken } from "@/utils/auth";
import print from 'print-js'
// import {getLodop} from "@/common/LodopFuncs";
export default {
  name: "KyinfoTb",
  data() {
    return {
      url:'../../assets/images/liu.jpeg',
      // 按钮loading
      buttonLoading: false,
      printShow:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 科研人员信息表格数据
      kyinfoTbList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: undefined,
        headPort: undefined,
        email: undefined,
        age: undefined,
        gender: undefined,
        national: undefined,
        position: undefined,
        title: undefined,
        degree: undefined,
        xl: undefined,
        xkfx: undefined,
        xszz: undefined,
        eName: undefined,
        cdxm: undefined,
        kjcg: undefined,
        zjgx: undefined,
        cyxm: undefined,
        hjqk: undefined,
        psxm: undefined,
        psyj: undefined,
        zzmm: undefined,
        jg: undefined,
        birthday: undefined,
        empNumbedr: undefined,
        userType: undefined,
        idNumber: undefined,
        entryTime: undefined,
        expertType: undefined,
        schoolCode: undefined,
        schoolName: undefined,
        collegeCode: undefined,
        collegeName: undefined,
        deptCode: undefined,
        expertLevel: undefined,
        deptName: undefined,
        phone: undefined,
        kytdlx: undefined,
        kytddm: undefined,
        rylb: 'kyry',
        userState: undefined,
        kytdmc: undefined,
        createUser: undefined,
        createDate: undefined,
        updateUser: undefined,
        updateDate: undefined,
      },
      // 表单参数
      form: {},
      info:{},
      // 科研人员导入参数
      upload: {
        // 是否显示弹出层（物料导入）
        open: false,
        // 弹出层标题（物料导入）
        title: "导入物料",
        // 是否禁用上传
        isUploading: false,
        type:'kyry',
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/business/kyinfoTb/importData"
      },
      // 表单校验
      rules: {
        id: [
          { required: true, message: "主键不能为空", trigger: "blur" }
        ],
        name: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ],
        headPort: [
          { required: true, message: "头像不能为空", trigger: "blur" }
        ],
        email: [
          { required: true, message: "邮箱不能为空", trigger: "blur" }
        ],
        age: [
          { required: true, message: "年龄不能为空", trigger: "blur" }
        ],
        gender: [
          { required: true, message: "性别不能为空", trigger: "blur" }
        ],
        national: [
          { required: true, message: "民族不能为空", trigger: "blur" }
        ],
        position: [
          { required: true, message: "职务不能为空", trigger: "blur" }
        ],
        title: [
          { required: true, message: "职称不能为空", trigger: "blur" }
        ],
        degree: [
          { required: true, message: "学位不能为空", trigger: "blur" }
        ],
        xl: [
          { required: true, message: "学历不能为空", trigger: "blur" }
        ],
        xkfx: [
          { required: true, message: "学科方向不能为空", trigger: "blur" }
        ],
        xszz: [
          { required: true, message: "学术专长不能为空", trigger: "blur" }
        ],
        eName: [
          { required: true, message: "英文名不能为空", trigger: "blur" }
        ],
        cdxm: [
          { required: true, message: "承担项目不能为空", trigger: "blur" }
        ],
        kjcg: [
          { required: true, message: "科技成果不能为空", trigger: "blur" }
        ],
        zjgx: [
          { required: true, message: "专家贡献不能为空", trigger: "blur" }
        ],
        cyxm: [
          { required: true, message: "参与项目不能为空", trigger: "blur" }
        ],
        hjqk: [
          { required: true, message: "获奖情况不能为空", trigger: "blur" }
        ],
        psxm: [
          { required: true, message: "评审项目不能为空", trigger: "blur" }
        ],
        psyj: [
          { required: true, message: "评审意见不能为空", trigger: "blur" }
        ],
        zzmm: [
          { required: true, message: "政治面貌不能为空", trigger: "blur" }
        ],
        jg: [
          { required: true, message: "籍贯不能为空", trigger: "blur" }
        ],
        birthday: [
          { required: true, message: "出生年月不能为空", trigger: "blur" }
        ],
        empNumbedr: [
          { required: true, message: "职工号不能为空", trigger: "blur" }
        ],
        userType: [
          { required: true, message: "人员类型不能为空", trigger: "change" }
        ],
        idNumber: [
          { required: true, message: "身份证号码不能为空", trigger: "blur" }
        ],
        entryTime: [
          { required: true, message: "入职时间不能为空", trigger: "blur" }
        ],
        expertType: [
          { required: true, message: "专家类别不能为空", trigger: "change" }
        ],
        schoolCode: [
          { required: true, message: "公司代码不能为空", trigger: "blur" }
        ],
        schoolName: [
          { required: true, message: "公司名称不能为空", trigger: "blur" }
        ],
        collegeCode: [
          { required: true, message: "公司代码不能为空", trigger: "blur" }
        ],
        collegeName: [
          { required: true, message: "公司名称不能为空", trigger: "blur" }
        ],
        deptCode: [
          { required: true, message: "部系代码不能为空", trigger: "blur" }
        ],
        expertLevel: [
          { required: true, message: "专家级别不能为空", trigger: "blur" }
        ],
        deptName: [
          { required: true, message: "部系名称不能为空", trigger: "blur" }
        ],
        phone: [
          { required: true, message: "电话不能为空", trigger: "blur" }
        ],
        kytdlx: [
          { required: true, message: "科研团队类型不能为空", trigger: "blur" }
        ],
        kytddm: [
          { required: true, message: "科研团队代码不能为空", trigger: "blur" }
        ],
        rylb: [
          { required: true, message: "人员类别不能为空", trigger: "blur" }
        ],
        userState: [
          { required: true, message: "人员状态不能为空", trigger: "blur" }
        ],
        kytdmc: [
          { required: true, message: "科研团队名称不能为空", trigger: "blur" }
        ],
        createUser: [
          { required: true, message: "创建人不能为空", trigger: "blur" }
        ],
        createDate: [
          { required: true, message: "创建日期不能为空", trigger: "blur" }
        ],
        updateUser: [
          { required: true, message: "修改人不能为空", trigger: "blur" }
        ],
        updateDate: [
          { required: true, message: "修改日期不能为空", trigger: "blur" }
        ],
        remark: [
          { required: true, message: "备注不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //打印科研人员
    printKyry(row){
      console.log(row)
      this.info = row
      this.printShow = true
    },
    printInfo(){
      // printBill
      const style = '@page{margin:0 10mm};'
      printJS({
        printable:'printBill',
        type:'html',
        header:'',
        targetStyles:['*'],
        style
      })
    },
    /** 查询科研人员信息列表 */
    getList() {
      this.loading = true;
      listAKyinfoTb(this.queryParams).then(response => {
        this.kyinfoTbList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        name: undefined,
        headPort: undefined,
        email: undefined,
        age: undefined,
        gender: undefined,
        national: undefined,
        position: undefined,
        title: undefined,
        degree: undefined,
        xl: undefined,
        xkfx: undefined,
        xszz: undefined,
        eName: undefined,
        cdxm: undefined,
        kjcg: undefined,
        zjgx: undefined,
        cyxm: undefined,
        hjqk: undefined,
        psxm: undefined,
        psyj: undefined,
        zzmm: undefined,
        jg: undefined,
        birthday: undefined,
        empNumbedr: undefined,
        userType: undefined,
        idNumber: undefined,
        entryTime: undefined,
        expertType: undefined,
        schoolCode: undefined,
        schoolName: undefined,
        collegeCode: undefined,
        collegeName: undefined,
        deptCode: undefined,
        expertLevel: undefined,
        deptName: undefined,
        phone: undefined,
        kytdlx: undefined,
        kytddm: undefined,
        rylb: undefined,
        userState: undefined,
        kytdmc: undefined,
        createUser: undefined,
        createDate: undefined,
        updateUser: undefined,
        updateDate: undefined,
        remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加科研人员信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getAKyinfoTb(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改科研人员信息";
      });
    },

    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "科研人员导入";
      this.upload.open = true;
    },

    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateAKyinfoTb(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addAKyinfoTb(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除科研人员信息编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return delAKyinfoTb(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('business/kyinfoTb/export', {
        ...this.queryParams
      }, `科研人员_${new Date().getTime()}.xlsx`)
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('business/kyinfoTb/importTemplate', {
      }, `科研人员模板.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
  }
};
</script>
<style lang="scss" scoped>
  .titleG{
    width: 100%;
    height: 50px;
    font-weight: 900;
    font-size: 40px;
    text-align: center;
    line-height: 50px;
    margin-top:20px;
    margin-bottom: 50px
  }
  .pBox{
    width: 100%;
    height: 600px;
    border: 2px solid black;
    .box_top{
      width: 100%;
      height: 210px;

      .tou{
        width: 22%;
        height: 210px;
        float: left;
        border-right: 2px solid gray;
        border-bottom: 2px solid gray;
      }
      .infoBox{
        width: 78%;
        height: 70px;
        float: left;
        color:black;
        display: flex;
        flex-direction: row;
        .item1{
          width: 15%;
          height: 70px;
          text-align: center;
          line-height: 70px;
          border-right: 1px solid black;
          border-bottom: 1px solid black;
          font-weight: 800;
          font-size: 18px;
        }
        .item2{
          width: 14%;
          height: 70px;
          text-align: center;
          line-height: 70px;
          border-right: 1px solid black;
          border-bottom: 1px solid black;
        }
        .item3{
          width: 28%;
          height: 70px;
          text-align: center;
          line-height: 70px;
          border-bottom: 1px solid black;
        }
      }
    }
    .box_bottom{
      width: 100%;
      height: 390px;
      /*background: red;*/
      .xiaBox{
        width: 100%;
        height: 130px;
        /*background: green;*/
        display: flex;
        flex-direction: row;
        .xiaName{
          width: 22%;
          height: 130px;
          border-right: 2px solid gray;
          border-bottom: 2px solid gray;
          text-align: center;
          line-height: 130px;
          font-weight: 800;
          color:black;
          font-size: 24px;
        }
        .xiaMain{
          width: 77%;
          height: 130px;
        }
        .xiaItem1{
          width: 22.4%;
          height: 130px;

          border-right: 1px solid black;
          border-bottom: 1px solid black;

          .xiaItem1_top{
            width: 100%;
            height: 65px;
            font-size: 18px;
            border-bottom: 1px solid black;
            text-align: center;
            line-height: 65px;
            font-weight: 800;
            color:black;
          }
          .xiaItem1_bottom{
            width: 100%;
            height: 65px;
            text-align: center;
            line-height: 65px;
            color:black;
          }
        }
        .xiaItem2{
          width: 33%;
          height: 130px;
          border-bottom: 1px solid black;
          .xiaItem2_top{
            width: 100%;
            height: 65px;
            font-size: 18px;
            border-bottom: 1px solid black;
            text-align: center;
            line-height: 65px;
            font-weight: 800;
            color:black;
          }
          .xiaItem2_bottom{
            width: 100%;
            height: 65px;
            text-align: center;
            line-height: 65px;
            color:black;
          }
        }
      }
    }
  }
</style>
